var initAdaptive = function (config,$window){
  if(typeof $window === 'undefined') $window = $(window);

  var windowWidth = $window.width();
  if(windowWidth<=config.designWidth){
    if(window['adaptive'].loaded){
      return;
    }
    window['adaptive'].loaded = true;
    windowWidth = config.designWidth;
  }else{
    window['adaptive'].loaded = false;
  }

  var radio = windowWidth/config.designWidth;
  window['adaptive'].designWidth = config.designWidth;
  window['adaptive'].baseFont = config.baseFont;
  window['adaptive'].maxWidth = config.maxWidth*radio;
  window['adaptive'].minWidth = config.minWidth*radio;
  window['adaptive'].init();
};

// todo::待解决因滚动条出现的20px的像素差
var $window = $(window),
  adaptiveConfig = {
  designWidth:1440,
  baseFont:16,
  //maxWidth:1200,
  maxWidth:1920,
  //minWidth:1140
  minWidth:1024
};

initAdaptive(adaptiveConfig,$window);
$window.resize(function (){
  initAdaptive(adaptiveConfig,$window);
});
